fix(windows): Fix npm wrapper scripts for Windows#193
Open
0okay wants to merge 1 commit intovercel-labs:mainfrom
Open
fix(windows): Fix npm wrapper scripts for Windows#1930okay wants to merge 1 commit intovercel-labs:mainfrom
0okay wants to merge 1 commit intovercel-labs:mainfrom
Conversation
This commit fixes the Windows wrapper scripts generated by npm to properly
call the native Windows binary instead of failing to find /bin/sh.
Changes:
- Updated bin/agent-browser.cmd to detect architecture and directly call
the agent-browser-win32-{arch}.exe binary
- Updated bin/agent-browser shell script to properly add .exe extension
for Windows binaries when running in Git Bash/MSYS environments
- Added proper error messages when binary is not found
Fixes the issue where running 'agent-browser' on Windows would fail with
"The system cannot find the path specified" or "/bin/sh.exe not found"
errors.
Testing:
- Tested on Windows 11 with PowerShell
- Tested on Windows 11 with CMD
- Verified binary detection and execution works correctly
Contributor
|
@0okay is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
|
||
| :: Detect architecture | ||
| set "ARCH=x64" | ||
| if "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "ARCH=arm64" |
Contributor
Comment on lines
+7
to
+9
| if "%PROCESSOR_ARCHITECTURE%"=="x86" ( | ||
| if not defined PROCESSOR_ARCHITEW6432 set "ARCH=x86" | ||
| ) |
Contributor
There was a problem hiding this comment.
Suggested change
| if "%PROCESSOR_ARCHITECTURE%"=="x86" ( | |
| if not defined PROCESSOR_ARCHITEW6432 set "ARCH=x86" | |
| ) | |
| :: Note: x86 detection (32-bit Windows) is not supported as only x64 binaries are built. | |
| :: On 32-bit systems, x64 emulation will be used (default ARCH=x64 above). |
Windows 32-bit detection sets ARCH=x86 but no agent-browser-win32-x86.exe binary is built, causing npm install to fail on 32-bit Windows systems
Comment on lines
+19
to
+20
| echo Error: agent-browser binary not found at %BINARY% >&2 | ||
| echo Run 'npm install' to download the binary, or 'npm run build:native' to build it locally. >&2 |
Contributor
There was a problem hiding this comment.
Suggested change
| echo Error: agent-browser binary not found at %BINARY% >&2 | |
| echo Run 'npm install' to download the binary, or 'npm run build:native' to build it locally. >&2 | |
| echo Error: agent-browser binary not found at %BINARY% | |
| echo Run 'npm install' to download the binary, or 'npm run build:native' to build it locally. |
Invalid stderr redirection syntax >&2 in Windows batch file that doesn't support Unix-style redirection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the Windows wrapper scripts generated by npm to properly call the native Windows binary instead of failing to find /bin/sh.
Changes
bin/agent-browser.cmdto detect architecture and directly call theagent-browser-win32-{arch}.exebinarybin/agent-browsershell script to properly add.exeextension for Windows binaries when running in Git Bash/MSYS environmentsProblem
On Windows, running
agent-browserwould fail with errors like:This was because the npm-generated wrapper scripts tried to use
/bin/shwhich doesn't exist on standard Windows installations.Solution
Modified the wrapper scripts to directly invoke the platform-specific native binary (
agent-browser-win32-x64.exe) instead of trying to run a shell script through/bin/sh.Testing
agent-browsercommand now works without errors